//
//  ViewController.m
//  FKVideoPlayerDemo
//
//  Created by 云眼科技 on 16/7/28.
//  Copyright © 2016年 CloudEyes. All rights reserved.
//

#import "ViewController.h"
#import "FKVideoPlayer/FKIndicatorView.h"

void fk_after(CGFloat timeInterval, void(^block)(void)){
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeInterval * NSEC_PER_SEC)), dispatch_get_main_queue(), block);
}


@interface ViewController ()

@property (nonatomic, strong) FKIndicatorView *indicatorView;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //添加一个按钮用于跳转视图
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeSystem];
    btn.frame = CGRectMake(50, 200, 275, 50);
    [btn setTitle:@"测试" forState:UIControlStateNormal];
    [btn addTarget: self action:@selector(showView) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:btn];

}

-(void)showView{
    [self.indicatorView showAnimated:YES onView:self.view];
    
    
    fk_after(self.indicatorView.dimissTimeInterval, ^{
        [self.indicatorView dismissViewAnimated:YES]; 
    });
    
}

-(FKIndicatorView *)indicatorView{
    if (!_indicatorView) {
        _indicatorView = [[FKIndicatorView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
        _indicatorView.title = @"fuck";
        _indicatorView.imageName = @"1";
    }
    return _indicatorView;
}

@end
